package dwz.persistence.beans;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import dwz.dal.object.AbstractDO;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class SysPermission extends AbstractDO{
	/**
	 *
	 */
	private static final long serialVersionUID = 6865798270179847491L;
	private Integer id;
	private String name;
	private Integer parent_id;
	private String href;
	private Integer level;

	private Boolean is_leaf;
	private String identity;
	private String parent_ids;
	private Boolean is_show;
	private String icon;
	private Boolean is_frame;
	private String created_by;
	private Date created_date;
	private String updated_by;
	private Date updated_date;
	private Boolean del_flag;

	private List<SysPermission> children;

	public SysPermission(){
	}

	@Override
	public Integer getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getParent_id() {
		return parent_id;
	}
	public void setParent_id(Integer parent_id) {
		this.parent_id = parent_id;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public Boolean getIs_leaf() {
		return is_leaf;
	}
	public void setIs_leaf(Boolean is_leaf) {
		this.is_leaf = is_leaf;
	}
	public String getHref() {
		return href;
	}
	public void setHref(String href) {
		this.href = href;
	}
	public String getIdentity() {
		return identity;
	}
	public void setIdentity(String identity) {
		this.identity = identity;
	}
	public String getParent_ids() {
		return parent_ids;
	}
	public void setParent_ids(String parent_ids) {
		this.parent_ids = parent_ids;
	}
	public Boolean getIs_show() {
		return is_show;
	}
	public void setIs_show(Boolean is_show) {
		this.is_show = is_show;
	}
	public Boolean getIs_frame() {
		return is_frame;
	}
	public void setIs_frame(Boolean isframe) {
		this.is_frame = isframe;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	public String getCreated_by() {
		return created_by;
	}
	public void setCreated_by(String created_by) {
		this.created_by = created_by;
	}
	public Date getCreated_date() {
		return created_date;
	}
	public void setCreated_date(Date created_date) {
		this.created_date = created_date;
	}
	public String getUpdated_by() {
		return updated_by;
	}
	public void setUpdated_by(String updated_by) {
		this.updated_by = updated_by;
	}
	public Date getUpdated_date() {
		return updated_date;
	}
	public void setUpdated_date(Date updated_date) {
		this.updated_date = updated_date;
	}
	public Boolean getDel_flag() {
		return del_flag;
	}
	public void setDel_flag(Boolean del_flag) {
		this.del_flag = del_flag;
	}

	public List<SysPermission> getChildren() {
		if(children!=null)
			return children;
		else
		{
			children = new ArrayList<SysPermission>();
			return children;
		}
	}

	public void setChildren(List<SysPermission> children) {
		this.children = children;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
				.append("Id",getId())
				.append("name",getName())
				.append("parent_id",getParent_id())
				.append("parent_ids",getParent_ids())
				.append("href",getHref())
				.append("identity",getIdentity())
				.append("is_show",getIs_show())
				.append("is_frame",getIs_frame())
				.append("icon",getIcon())
				.append("created_by",getCreated_by())
				.append("created_date",getCreated_date())
				.append("updated_by",getUpdated_by())
				.append("updated_date",getUpdated_date())
				.append("del_flag",getDel_flag())
				.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
				.append(getId())
				.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof SysPermission == false) return false;
		if(this == obj) return true;
		SysPermission other = (SysPermission) obj;
		return new EqualsBuilder()
				.append(getId(),other.getId())
				.append(getName(),other.getName())
				.append(getIdentity(),other.getIdentity())
				.isEquals();
	}
}

